/**
 * @ClassName LC1351
 * @Author ykx
 * @Date 2024/7/9 19:55
 * @Version 1.0
 */
public class LC1351 {
    public int countNegatives(int[][] grid) {
        int result = 0;

        for (int[] ints : grid) {
            for (int j = 0; j < ints.length; j++) {
                if (ints[j] < 0) {
                    result += ints.length - j;
                    break;
                }
            }
        }

        return result;
    }
}
